package com.wyh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wyh.bean.User;
import com.wyh.common.bean.PageBean;
import com.wyh.common.crud.BaseServiceImpl;
import com.wyh.mapper.UserMapper;
import com.wyh.query.UserQuery;
import com.wyh.service.UserService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends BaseServiceImpl<User, UserMapper> implements UserService{


    @Override
    public PageBean query(UserQuery query) {
//分页查询
        PageHelper.startPage(query.getPage(), query.getPageSize());//后面紧跟查询
        List list=baseMapper.query(query);
        PageInfo info=new PageInfo(list);
        return new PageBean(query.getPage(), query.getPageSize(), info.getTotal(),list);
    }
}
